<template>
     <div>
       <p>商品数量:{{msg}}</p>
       <button v-on:click="addFn">点击加</button>
       <button v-on:click="subFn">点击减</button>
       <button v-on:click="fiveFn(5)">点击加五</button>
       <button @click="subnumFn(5)">点击减5</button>
     </div>
</template>

<script>
export default {
      data () {
        return {
          msg:0
        }
      },
      methods: {
        
        addFn(){
          this.msg++
        },
        subFn(){
          this.msg--;
        },
        fiveFn(n){
          this.msg+=n
        },
        subnumFn(n){
          this.msg-=n;
        },
      }
}
</script>

<style>

</style>